<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function toPage(flag){
            var pageNum = parseInt($("[name=pageNum]").val());
            var totalPage = parseInt($("[name=totalPage]").val());

            if(flag == 0){//首页
                if(pageNum <= 1){
                    alert("当前为首页")
                    return;
                }
                $("[name=pageNum]").val(1);
            }else if(flag == 1){
                //如果当前也是第一页 则提示当前已经为首页
                if(pageNum <= 1){
                    alert("当前页为首页");
                    return ;
                }
                $("[name=pageNum]").val(pageNum - 1);
            }else  if(flag == 2){
                //如果当前页是最后一页 则提示当前页为尾页
                if(totalPage <= pageNum){
                    alert("当前为尾页");
                    return ;
                }
                $("[name=pageNum]").val(pageNum + 1);
            }else if(flag == 3){
                if(totalPage <= pageNum){
                    alert("当前为尾页");
                    return ;
                }
                $("[name=pageNum]").val(totalPage);
            }
            selectObj();
        }

        function buildPage(page){
            $("[name=pageNum]").val(page.pageNum);
            $("[name=pageSize]").val(page.pageSize);
            $("[name=totalCount]").val(page.total);
            $("[name=totalPage]").val(page.lastPage);
        }

    </script>
</head>
<body>
当前第<input type="text" name="pageNum" size="2" readonly>页
每页<input type="text" name="pageSize" size="2" readonly>条
共<input type="text" name="totalCount" size="2" readonly>条
共<input type="text" name="totalPage" size="2" readonly>页

<a href="javascript:toPage(0)">首页</a>
<a href="javascript:toPage(1)">上一页</a>
<a href="javascript:toPage(2)">下一页</a>
<a href="javascript:toPage(3)">尾页</a>
</body>
</html>